#ifndef QTPROJ_QGANTTCHART_COLUMN_HEADER_QTH
#define QTPROJ_QGANTTCHART_COLUMN_HEADER_QTH

#include "QtProj/QGanttChartHeader.qth"
#include <QtGui/QPainter>
#include <QtCore/QDateTime>

namespace QtProj
{

	class QAbstractGanttModel;

class QHeaderPaintContext
{
public:
	QHeaderPaintContext( 
			QPainter& painter, const QRect& headerRect, const QDateTime& firstColumnTime, QGanttChartHeader::ZoomLevels zoomLevel, int colWidth)
		: painter_( painter)
		, headerRect_( headerRect)
		, firstColumnTime_( firstColumnTime)
		, zoomLevel_( zoomLevel)
		, columnWidth_( colWidth)
	{ }

	QPainter& painter() { return painter_; }
	const QRect& headerRect() const { return headerRect_; }
	const QDateTime& firstColumnTime() const { return firstColumnTime_; }
	const QGanttChartHeader::ZoomLevels zoomLevel() const { return zoomLevel_; }
	int columnWidth() const { return columnWidth_; }


private:
	QPainter& painter_;
	const QRect& headerRect_;
	QDateTime firstColumnTime_;
	int columnWidth_;
	QGanttChartHeader::ZoomLevels zoomLevel_;

};

class QGanttChartColumnHeader
{
public:
	virtual void paint( QHeaderPaintContext& ctx) = 0;

	virtual int maxNumberOfColumns( const QAbstractGanttModel& model) const = 0;


protected:
	void drawBottomLine( QHeaderPaintContext& ctx);
	int calculateNumberOfColumns( const QHeaderPaintContext& ctx) const;
	int calculateMiddleLineLevel( const QHeaderPaintContext& ctx) const;
};


} // namespace QtProj

#endif // QTPROJ_QGANTTCHART_COLUMN_HEADER_QTH
